<% /* $Id: user.jsp 101 2010-12-26 21:25:55Z altdotua@gmail.com $ */ %>

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>

<%@ include file="../header.jsp" %>

<%
	Map<String, Object> sessReq = new HashMap<String, Object>();
	sessReq.put("order", "id DESC");
	List<SessionEntry> sessions = SessionsModel.getEntries(sessReq);
	
	Map<String, Object> sessReq2 = new HashMap<String, Object>();
	sessReq2.put("order", "id DESC");
	sessReq2.put("expireTime<", new Date());
	List<SessionEntry> sessionsOld = SessionsModel.getEntries(sessReq2);
%>

<form action="<%= Linker.link("login") %>" method="post">
	<input type="hidden" name="action" value="customEdit">
	<input type="hidden" name="return" value="<%= requestUrl %>">
	<table>
		<tr>
			<th>Action</th>
			<th>Current</th>
			<th>Change</th>
		</tr>
		<tr>
			<td>Kill old sessions</td>
			<td><%= sessionsOld.size() %></td>
			<td><input type="submit" value="Change" name="killOldSessions" /></td>
		</tr>
		<tr>
			<td>Kill all sessions</td>
			<td><%= sessions.size() %></td>
			<td><input type="submit" value="Change" name="killSessions" /></td>
		</tr>
	</table>
</form>


<h2 align="center">Sessions</h2>
<%= (new SessionsFormatter()).format(sessions) %>

<%@ include file="../footer.jsp" %>
